package com.passer.toolbox.tfile;

import com.passer.toolbox.tfile.command.FileCreate;
import com.passer.toolbox.tfile.command.FileSize;
import com.passer.toolbox.tfile.command.filededuplication.FileDeduplication;
import com.passer.toolbox.tfile.constant.CommandHelp;

public class TFileBoot {
    public static void main(String[] args) {
        if (args.length < 1) {
            showHelp();
            return;
        }
        CommandHelp inputCommand = CommandHelp.valueOf(args[0]);
        switch (inputCommand) {
            case filesize:
                FileSize fileSize = new FileSize();
                fileSize.starter(args.length > 1 ? args[1] : null);
                break;
            case filededuplication:
                FileDeduplication fileDeduplication = new FileDeduplication();
                fileDeduplication.starter(args.length > 1 ? args[1] : null);
                break;
            case filecreate:
                FileCreate fileCreate = new FileCreate(args.length > 1 ? args[1] : null);
                fileCreate.createSameNameFolder(args.length > 2 ? args[2] : null);
                break;
            default:
                showHelp();
        }
    }

    private static void showHelp() {
        System.out.println("请输入正确参数！");
        for (CommandHelp commandHelp : CommandHelp.values()) {
            System.out.println(commandHelp.getCommand() + '\t' + commandHelp.getBrief());
        }
    }
}
